﻿@{
    ViewBag.Title = "MyInfo";
    Layout = "~/Views/Shared/Template.cshtml";
}

<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="~/static/collect.css" rel="stylesheet" />
<link href="~/static/myhome.css" rel="stylesheet" />

<style>
    .personal_info {
        margin-left: 20%;
        margin-top: 10%;
    }

    table tr {
        height: 50px;
    }
</style>

@using Partner.MVC.Models;
@{
    var user = Session["LoginUser"] as User_Info;
}

<div style="height: 300px;width: 100%;background:url(/static/hbweb/images/me.jpg);">
    <div class="container">
        <div class="header-message">
            <img class="fl" id="f1" src="http://pic.huobanchina.com/o_1bp7omfg8e821pc4bbg1u8g1ifl9.jpeg" alt="" />
            <div class="fl header-text">
                <h3 class="user-name">@user.Use_Name </h3>
                <i class="icon-fabu3 point user-namei"></i>
            </div>
            <a id="AlterPwd" style="width:85px;" data-toggle="modal" data-target="#myModal" class="fr fn-font-hover-blue change change-password">
                修改密码
            </a>
        </div>
    </div>
</div>

<div class="bgcSil">
    <div class="container">
        <div class="mt30" style="width: 100%">
            <ul id="divLeft" style="width:24%" class="nav navbar-nav"></ul>
            <div id="divContent" style="width:75%;" class="fr mb80 cont bgcWhit news-list-con">
                <div class="personal_info">
                    <h3 class="title">个人中心</h3>
                    <div class="fb_box">
                        <table>
                            <tr>
                                <td>修改头像</td>
                                <td><input id="S_Img" type="file" /></td>
                                <td style="display:none" id="img">@*<img style="width:250px;height:150px" id="img" src="" alt="" /></td>*@
                                <td><input type="button" onclick="UptImage()" class="btn btn-primary radius" value="点击修改" /></td>
                            </tr>
                            <tr>
                                <td><span class="c-red">真实姓名：</span></td>
                                <td>@Model.Use_ReallyName</td>
                            </tr>
                            <tr>
                                <td><span>手机号：</span></td>
                                <td>@Model.Use_Telphone</td>
                            </tr>
                            <tr>
                                <td><span>身份证号：</span></td>
                                <td>@Model.Use_IdCard</td>
                            </tr>
                            <tr>
                                @*<td>
                                        <div>
                                            <img id="img" src="" alt="" />
                                        </div>
                                    </td>*@
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 左侧导航-->
<script>
    ParentNav();
    // 绑定根节点
    function ParentNav() {
        $.ajax({
            type: "post",
            url: "/Partner/LeftNav",
            dataType: "json",
            success: function (data) {
                var htmltab = "";
                for (var i = 0; i < data.length; i++) {
                    htmltab += "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" style=\"width: 175px;font-size: 16px;\">" + data[i].Lar_Name + "</a>" + SonNav(data[i].Limit_Id) + "</li>";
                }
                $("#divLeft").append(htmltab);
            },
            error: function (err) {
                alert(err);
            }
        })
    }
    // 绑定子节点
    function SonNav(id) {
        var html1 = "";
        $.ajax({
            type: "post",
            url: "/Partner/LeftSon",
            data: { pid: id },
            dataType: "json",
            async: false,
            success: function (data) {
                var strhtml = "<ul class=\"dropdown-menu\">"
                for (var i = 0; i < data.length; i++) {
                    strhtml += "<li><a href=\"" + data[i].Limit_Url + "\">" + data[i].Limit_Name + "</a></li>"
                }
                strhtml += "</ul>";
                html1 = strhtml;
            }
        })
        return html1;
    }
</script>
<script>
    show();
    //实现修改图片的功能
    function UptImage() {
        var file = document.getElementById("S_Img").files[0];
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function (e) {
            var model = { Use_Img: this.result };
            $.ajax({
                type: "post",
                url: "/UserCenter/UptImage",
                data: { Use_Img: this.result },
                success: function (obj) {
                    if (obj > 0) {
                        alert('修改成功')
                        location.href = '/Partner/MyCenter'
                    }
                }
            })
        }
    }

    //function show()
    //{
    //$.ajax({
    //    type: "post",
    //    url: "/UserCenter/ReturnPhoto",
    //    data: { Use_Img: this.result },
    //    success: function (obj) {
    //        alert(obj);
    //        $("#img").attr("src",obj)
    //        }

    //})
    //}
</script>